<template>
  <a-card :bordered="false">
    <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-form-model-item label="营业时间">
        <j-time date-format="HH:mm" v-model="form.morning_time_begin"/>
        -
        <j-time date-format="HH:mm" v-model="form.morning_time_end"/>
      </a-form-model-item>
      <a-form-model-item label="营业时间">
        <j-time date-format="HH:mm" v-model="form.afternoon_time_begin"/>
        -
        <j-time date-format="HH:mm" v-model="form.afternoon_time_end"/>
      </a-form-model-item>
      <a-form-model-item label="统计订单时间">
        <j-time date-format="HH:mm" v-model="form.order_statistics_time_begin"/>
        -
        <j-time date-format="HH:mm" v-model="form.order_statistics_time_end"/>
      </a-form-model-item>
      <a-form-model-item label="商户公告">
        <a-textarea :rows="4" v-model="form.merchant_announcement"/>
      </a-form-model-item>
      <a-form-model-item label="分享返现金额">
        <a-input-number :min="0" :max="100" v-model="form.amount_of_shared_cash_back"/>
      </a-form-model-item>
      <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
        <a-button type="primary" @click="handleSubmit">
          保存
        </a-button>
      </a-form-model-item>
    </a-form-model>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import HcSystemConfModal from './modules/HcSystemConfModal'
import {getAction, postAction} from "@api/manage";

export default {
  name: 'HcSystemConfList',
  mixins: [mixinDevice],
  components: {
    HcSystemConfModal
  },
  data() {
    return {
      labelCol: {span: 4},
      wrapperCol: {span: 14},
      form: {
        wx_QRcode: ''
      },
    }
  },
  mounted() {
    getAction("/hc/hcSystemConf/getAllSystemConf").then(res => {
      if (res.success) {
        this.form = res.result;
      }
    });
  },
  methods: {
    handleSubmit() {
      console.log("this.form", this.form)
      const that = this;
      postAction("/hc/hcSystemConf/add", this.form).then(res => {
        res.success ? that.$message.success("保存成功") : that.$message.warning(res.message);
      });
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>